package com.abucloud.logbackdemo.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateFormatUtils {

    private static final ThreadLocal<SimpleDateFormat> SIMPLE_DATE_FORMAT_THREAD_LOCAL =
            ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd"));

    public static String formatDate(Date date) {

        return SIMPLE_DATE_FORMAT_THREAD_LOCAL
                .get()
                .format(date);
    }
}
